PROJECT=hpjpc

all: $(PROJECT).pdf

snips: parsubs.in.tex monitors.in.tex
	python ../snipins/snipinscompile.py ../hpjpc-examples/src -o snips
	python ../snipins/snipinsexpand.py snips parsubs.in.tex -o parsubs.tex
	python ../snipins/snipinsexpand.py snips monitors.in.tex -o monitors.tex
	

$(PROJECT).pdf: snips choregraphs.tex chores.tex coordination.tex hpjpc.tex javathreads.tex \
  monitors.tex networking.tex parallel.tex parloops.tex parsubs.tex races.tex \
  stoq.tex streams.tex title.tex 
	pdflatex $(PROJECT)
	@echo "Second run (silenced)"
	2>&1 pdflatex $(PROJECT) > /dev/null
	# bibtex $(PROJECT)
	2>&1 pdflatex $(PROJECT) > /dev/null
	pdflatex $(PROJECT)

# These rules are aimed at making it easier to remember how to "view" the resultant file
# on various platforms
# e.g. if on OS X, type "make osx"
# if on Linux/KDE, type "make kde"

osx:
	open $(PROJECT).pdf

gnome:
	evince $(PROJECT).pdf

kde:
	okular $(PROJECT).pdf

acroread:
	acroread $(PROJECT).pdf

clean:
	rm -f $(PROJECT).aux $(PROJECT).css $(PROJECT).htm $(PROJECT).log $(PROJECT).pdf
	rm -f *~ *.aux *.toc
	rm -f snips
	rm parsubs.tex
